import {baseAjax} from '../baseAjax'

// 获取地区树
export function getAreaTree (data, successHandle, failHandle) {
  baseAjax('/ent/area/tree', data, 'post', successHandle, failHandle)
}

// 获取区域树
export function getRegionTree (data, successHandle, failHandle) {
  baseAjax('/ent/area/tree', data, 'post', successHandle, failHandle)
}

// 获取城市地区列表
export function getRegionList (data, successHandle, failHandle) {
  baseAjax('/ent/area/list', data, 'post', successHandle, failHandle)
}

// 删除地区
export function deleteRegion (id, successHandle, failHandle) {
  let _url = '/ent/area/' + id
  baseAjax(_url, {}, 'delete', successHandle, failHandle)
}

// 修改区域
export function updateRegion (data, successHandle, failHandle) {
  baseAjax('/ent/area', data, 'put', successHandle, failHandle)
}

// 新增区域
export function addRegion (data, successHandle, failHandle) {
  baseAjax('/ent/area/save', data, 'post', successHandle, failHandle)
}

// 分配区域
export function allocateRegion (data, successHandle, failHandle) {
  baseAjax('/ent/area/user/config', data, 'put', successHandle, failHandle)
}
